/**
 * @Author 12629
 * @Description：
 */

class MyValue {
    public int val;
}

public class Test {

    public static void swap1(MyValue myValue1,MyValue myValue2) {
        int tmp = myValue1.val;
        myValue1.val = myValue2.val;
        myValue2.val = tmp;
    }

    public static void swap(MyValue myValue1,MyValue myValue2) {
        MyValue tmp= myValue1;
        myValue1 = myValue2;
        myValue2 = tmp;
    }

    public static void func1(int[] array) {
        array = new int[]{1,2,3,4,5};
    }

    public static void func2(int[] array) {
        array[0] = 10;
    }

    public static void main(String[] args) {
        MyValue myValue1 = new MyValue();
        myValue1.val = 10;

        MyValue myValue2 = new MyValue();
        myValue2.val = 20;

        System.out.println("交换前："+myValue1.val+" " + myValue2.val);
        swap(myValue1,myValue2);
        System.out.println("交换后："+myValue1.val+" " + myValue2.val);
    }
}
